// @/components/chart/index.js
import Render from './index.rjs';

import picture from '../../../public/newImage/lightTop.png';

Component({
  properties: {
    color: {
      type: String,
      value: '#000',
    },
    className: {
      type: String,
      value: '',
    },
  },
  data: {
    src: picture,
  },
  lifetimes: {
    attached() {
      this.rjs = new Render(this);
    },
    ready: function() {
      this.renderRjs(this.data.src, this.data.color);
    },
  },
  observers: {
    color: function(data) {
      this.renderRjs(this.data.src, data);
    },
  },
  methods: {
    renderRjs(src, color) {
      if (this.rjs) {
        this.rjs.getDOMByRJS(src, color);
      }
    },
  },
});
